package com.igoal.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.igoal.dao.FamousQuoteDAO;
import com.igoal.dto.FamousQuoteDTO;
import com.igoal.entity.FamousQuote;

@Service("commonService")
public class CommonServiceImpl implements CommonService {

	private FamousQuoteDAO famousQuoteDAO;

	@Autowired
	public void setFamousQuoteDAO(FamousQuoteDAO famousQuoteDAO) {
		this.famousQuoteDAO = famousQuoteDAO;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.igoal.service.CommonService#getRandomFamousQuote()
	 */
	public FamousQuoteDTO getRandomFamousQuote() {
		FamousQuote famousQuote = famousQuoteDAO.genrateRandomQuote();
		FamousQuoteDTO dto = new FamousQuoteDTO();
		dto.initFrom(famousQuote);
		return dto;
	}
}
